<template>
  <div class="bg-light">
    <homeTable
        :list="list" 
        :hasPage='false'
        @getData="getData"
        @onPageSizeChange="onPageSizeChange"
        @onPageChange="onPageChange"
      />
    </TabPane>
  </div>
</template>
<script>
  import homeTable from '@/components/homeTable'

  export default {
    props: {
      form: {
        type: Object
      }
    },
    components: {
      homeTable
    },
    data() {
      return {
        list: {
          status: 'pass',
          totalItem: 1,
          pageSize: window.$pageSize,
          currentPage: 1,
          columns: [{
            title: '合同名称',
            key: 'name',
            align: 'left',
          }, {
            title: '合同编号',
            key: 'sn',
          }, {
            title: '预签开始日期',
            key: 'preStartDate',
            align: 'left',
          }, {
            title: '预签结束日期',
            key: 'preEndDate',
            align: 'left',
          }, {
            title: '合同开始日期',
            key: 'startDate',
            align: 'left',
          }, {
            title: '合同结束日期',
            key: 'endDate',
            align: 'left',
          }, {
            title: '创建时间',
            key: 'createDate',
            align: 'left',
          }, {
            title: '第三方确认时间',
            key: 'signConfirmDate',
            align: 'left',
          }, {
            title: '操作',
            align: 'left',
            render: (h, params) => {
            return  <router-link to={`/setting/contract/edit?id=${params.row.aggreementId}&mode=info`}>查看合同内容</router-link>
            }
          }],
          data: []
        }
      }
    },
    mounted () {
      this.getData()
    },
    methods: {
      getData() {
        let contractId = this.form.storeContractDTO.id
        if(!contractId) return
        let param = {
          current: this.list.currentPage,
          size: this.list.pageSize,
          contractId
        };
        this.list.status = "loading";
        this.$ajaxGet(`/contract_store/detail_agreement/${contractId}`, param).then(data => {
          this.list.data = (data || [])
          this.list.status = "pass";
        })
        .catch(() => {
        });
      },
    },
    computed: {

    }
  }
</script>
